import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.util.Arrays;
import java.util.Comparator;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-04-07
 * Time: 15:56
 */
//比较器

class Agecomparator implements Comparator<Student> {
        @Override
        public int compare(Student o1, Student o2) {
            return o1.age - o2.age;
        }
}
class Namecomparator implements Comparator<Student> {
    @Override
    public int compare(Student o1, Student o2) {
        return o1.name.compareTo(o2.name);
    }
}
public class Test01 {
    public static void main(String[] args) {
        Student [] student = {
                new Student("abc",10,55.5),
                new Student("ckl",150,42.8),
                new Student("bmn",55,28)
        };
        Agecomparator agecomparator = new Agecomparator();
        Namecomparator namecomparator = new Namecomparator();
        Arrays.sort(student,namecomparator);
        System.out.println(Arrays.toString(student));
    }
}
